<?php 
    $auth = Auth::getAuth('current_user');
    $db = new Database();
    $getForms = $db->query("SELECT id,form_name FROM tb_workspace WHERE company_id={$db->escape($auth['company_id'])} AND is_active =1","array");
    $getForm_properties = $db->query("SELECT * FROM tb_workspace WHERE id={$db->escape($form_id)}", "row");
    $search = new Search();

    $active_fields = functions::getFormFields($form_id);
    $form_columns = array();
    foreach ($active_fields as $value) {
        array_push($form_columns, $value);
    }

    //form properties and others
    echo '<input type="text" class="class form_buttons display" value="' . $getForm_properties['form_buttons'] . '">';
    echo '<input type="text" class="class form_fields display" value=' . json_encode($form_columns) . ' />';
    echo '<div class="company_forms display">' . htmlspecialchars(json_encode($getForms)) . ' </div>';
    $getForms = $search->getForms();

    echo '<div class="json-data-forms" style="display:none;">';
        echo htmlspecialchars(json_encode($getForms));
    echo '</div>';

    //get departments
    $getAllDepartment = $search->getAllDepartment();
    echo "<div class='departments display'>" . json_encode($getAllDepartment) . "</div>";

    //get positions
    $getPosition = $search->getAllPosition();
    echo "<div class='positions display'>" . json_encode($getPosition) . "</div>";

    //get users
    $getUsers = $search->getAllUsers();
    echo "<div class='users display'>" . json_encode($getUsers) . "</div>";
?>
<link rel="stylesheet" href="/css/jquery-ui.css" />

<div class="fl-option-toolbar">
    <div class="fl-toolbar-left-wrapper">
        <h1>Rule Settings</h1>
    </div>
    
    <div class="fl-toolbar-right-wrapper">
        <!-- <a class="pinit icon dataTip" fl-data-application-id="1" fl-data-type="widget" fl-data-object-id="notif" data-placement="left" data-original-title="Pin this to Dashboard"></a> -->
    </div>
</div><!-- end of option toolbar -->
 <input type="button" class="btn-blueBtn create-new-rule" value="Create new rule" style="width:auto">
 <br/> <br/>
 <h3>List of rules</h3><Br/>
 <div class="fl-middleware-wrapper"> 
    <table style="width:100%" class="fl-middleware-table">
        <thead>
            <tr>
                <th><div class="fl-table-ellip">Rule name</div></th>
                <th><div class="fl-table-ellip">Description</div></th>
                <th><div class="fl-table-ellip">Actions</div></th>
                <th><div class="fl-table-ellip">Status</div></th>
            </tr>
        </thead>
        <tbody>
            <tr class="no-data-yet">
                <td colspan="4"><div class="fl-table-ellip">No Data Yet</div></td>
            </tr>
        </tbody>
    </table>
 </div>

<!-- <div id="accordion">
    <label>To:</label>
    <div class="fp-container email-to">
        <div style="width:100%;display:inline-block">
            <div style="width:30%;float:left">
                <label class="font-bold">
                    <input type="checkbox" class="email-requestor" value="All Users">Requestor</label>
            </div>
            <div style="width:50%;float:left">
                <label class="font-bold">
                    <input type="checkbox" class="email-processor" value="All Users">Next Processor</label>
            </div>
        </div>
        <label>
            <input type="checkbox" class="fp-allUsers" value="All Users">All Users</label>
        <br>
        <div class="content-dialog-scroll ps-container" style="position: relative; margin-left: 20px; padding: 0px; width: 100%; height: 240px;overflow: hidden;">
            <div id="content-dialog-scroll">
                <div class="content-dialog" style="width: 90%;height: auto;">
                    <div class="container-formUser">
                        <div class="formUser" rel="getDepartmentFF">
                            <label class="fa fa-minus"></label>
                            <label class="font-bold">Department</label>
                        </div>
                        <div class="getDepartmentFF" style="display:inline-block;width:120%;margin-left:10px;margin-top:5px;">

                        </div>
                    </div>
                    <div class="container-formUser">
                        <div class="formUser" rel="getPositionFF">
                            <label class="fa fa-minus"></label>
                            <label class="font-bold">Position</label>
                        </div>
                        <div class="getPositionFF" style="display:inline-block;width:120%;margin-left:10px;margin-top:5px;">
                            
                        </div>
                    </div>
                    <div class="container-formUser">
                        <div class="formUser" rel="getUsersFF">
                            <label class="fa fa-minus"></label>
                            <label class="font-bold">Users</label>
                        </div>
                        <div class="getUsersFF" style="display:inline-block;width:120%;margin-left:10px;margin-top:5px;">
                            
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>
    <label>CC:</label>
    <div class="fp-container email-cc">
        <div style="width:100%;display:inline-block">
            <div style="width:30%;float:left">
                <label class="font-bold">
                    <input type="checkbox" class="email-requestor" value="All Users">Requestor</label>
            </div>
            <div style="width:50%;float:left">
                <label class="font-bold">
                    <input type="checkbox" class="email-processor" value="All Users">Next Processor</label>
            </div>
        </div>
        <label>
            <input type="checkbox" class="fp-allUsers" value="All Users">All Users</label>
        <br>
        <div class="content-dialog-scroll ps-container" style="position: relative; margin-left: 20px; padding: 0px; width: 100%; height: 240px;overflow: hidden;">
            <div id="content-dialog-scroll">
                <div class="content-dialog" style="width: 90%;height: auto;">
                    <div class="container-formUser">
                        <div class="formUser" rel="getDepartmentFF">
                            <label class="fa fa-minus"></label>
                            <label class="font-bold">Department</label>
                        </div>
                        <div class="getDepartmentFF" style="display:inline-block;width:120%;margin-left:10px;margin-top:5px;">

                        </div>
                    </div>
                    <div class="container-formUser">
                        <div class="formUser" rel="getPositionFF">
                            <label class="fa fa-minus"></label>
                            <label class="font-bold">Position</label>
                        </div>
                        <div class="getPositionFF" style="display:inline-block;width:120%;margin-left:10px;margin-top:5px;">
                            
                        </div>
                    </div>
                    <div class="container-formUser">
                        <div class="formUser" rel="getUsersFF">
                            <label class="fa fa-minus"></label>
                            <label class="font-bold">Users</label>
                        </div>
                        <div class="getUsersFF" style="display:inline-block;width:120%;margin-left:10px;margin-top:5px;">
                            
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>
    <label>BCC:</label>
    <div class="fp-container email-bcc">
        <div style="width:100%;display:inline-block">
            <div style="width:30%;float:left">
                <label class="font-bold">
                    <input type="checkbox" class="email-requestor" value="All Users">Requestor</label>
            </div>
            <div style="width:50%;float:left">
                <label class="font-bold">
                    <input type="checkbox" class="email-processor" value="All Users">Next Processor</label>
            </div>
        </div>
        <label>
            <input type="checkbox" class="fp-allUsers" value="All Users">All Users</label>
        <br>
        <div class="content-dialog-scroll ps-container" style="position: relative; margin-left: 20px; padding: 0px; width: 100%; height: 240px;overflow: hidden;">
            <div id="content-dialog-scroll">
                <div class="content-dialog" style="width: 90%;height: auto;">
                    <div class="container-formUser">
                        <div class="formUser" rel="getDepartmentFF">
                            <label class="fa fa-minus"></label>
                            <label class="font-bold">Department</label>
                        </div>
                        <div class="getDepartmentFF" style="display:inline-block;width:120%;margin-left:10px;margin-top:5px;">

                        </div>
                    </div>
                    <div class="container-formUser">
                        <div class="formUser" rel="getPositionFF">
                            <label class="fa fa-minus"></label>
                            <label class="font-bold">Position</label>
                        </div>
                        <div class="getPositionFF" style="display:inline-block;width:120%;margin-left:10px;margin-top:5px;">
                            
                        </div>
                    </div>
                    <div class="container-formUser">
                        <div class="formUser" rel="getUsersFF">
                            <label class="fa fa-minus"></label>
                            <label class="font-bold">Users</label>
                        </div>
                        <div class="getUsersFF" style="display:inline-block;width:120%;margin-left:10px;margin-top:5px;">
                            
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>
</div> -->